/*
 * ResourceGuildBuffValue.h
 *
 *  Created on: 2014. 8. 1.
 *      Author: mega
 */

#ifndef RESOURCEGUILDBUFFVALUE_H_
#define RESOURCEGUILDBUFFVALUE_H_

#include <map>
#include "../Enum.h"

namespace GuildServer { namespace NResource {

class ResourceGuildBuffValue
{
public:
	struct Key
	{
		Key() : tid(0), level(0) {}
		Key(int rType, int rSubType) : tid(rType), level(rSubType) {}

		int tid;
		int level;

		bool operator == (const Key & rSide) const
		{
			if (this->tid == rSide.tid && this->level == rSide.level)
				return true;

			return false;
		}

		bool operator < (const Key & rSide) const
		{
			if (this->tid < rSide.tid)
			{
				return true;
			}
			else if (this->tid == rSide.tid)
			{
				if (this->level < rSide.level)
					return true;
			}

			return false;
		}
	};

public:
	struct Flyweight
	{
		uint16_t	skill_tid;
		uint16_t	skill_level;
		uint16_t	skill_value;
	};

public:
	ResourceGuildBuffValue();
	virtual ~ResourceGuildBuffValue();

	bool		LoadResource();
	Flyweight *	GetFly(Key & clsKey);

private:
	void		Clear();

public:
	typedef std::map<Key, Flyweight *>		BUFFVALUEMAP;

private:
	BUFFVALUEMAP	clsFlyMap;
};

} /* namespace NResource */ } /* namespace GuildServer */

#endif /* RESOURCEGUILDBUFFVALUE_H_ */
